package com.HomeWorkhsp.Chapter07;

/**
 * Enjoy programming!!!
 * Time: 2021/11/10 -  21:03
 */
public class Test12 {
    public static void main(String[] args) {
        Circle01 c = new Circle01();
        PassObject p = new PassObject();
        p.printAreas(c, 5);
    }
}

class Circle01 {
    double radius;
    public Circle01(){}
    public Circle01(double radius){
        this.radius = radius;
    }

    public double findArea() {
        return radius * radius * Math.PI;
    }
    public void setRadius(double radius){
        this.radius = radius;
    }
}


class PassObject {
    public void printAreas(Circle01 c, int times) {
        System.out.println("radius\tarea");
        for (int i = 1; i <= times; i++) {
            c.setRadius(i);
            System.out.print((double)i + "\t" + c.findArea());
            System.out.println();
        }
    }
}
